package model

import (
	"log"
)

//结构体账户
type Accout struct {
	AccoutId    int64   `xorm:"pk autoincr notnull 'accout_id'"`
	AccoutName  string  `xorm:"unique notnull 'accout_name'"`
	AccoutMoney float64 `xorm:"notnull 'accout_money'"`
	Version     int     `xorm:"version"`
}

func NewAccout(name string, money float64) {
	_, err := Engine.Insert(Accout{AccoutName: name, AccoutMoney: money})
	if err != nil {
		log.Printf("insrt count err = %s \n", err)
	}
}

func GetAccout() []Accout {
	list := make([]Accout, 0)
	Engine.Limit(1000, 0).Find(&list)
	return list
}
